package com.service.admin.base.service.impl;

import com.service.admin.base.controller.req.AnalysisReq;
import com.service.admin.base.service.AnalysisService;
import com.service.dao.enums.CoinsEnum;
import com.service.dao.mapper.MemberStoreMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Slf4j
@Service
public class AnalysisServiceImpl implements AnalysisService {

    @Autowired
    private MemberStoreMapper memberStoreMapper;

    @Override
    public List<Object> queryCoinsAvailableData(AnalysisReq analysisReq) {
        //过滤条件== 账号
        String filterstr = "";
        if(StringUtils.isNotBlank(analysisReq.getFilters())){
            String[] filters = analysisReq.getFilters().split(",");

            for (String f : filters){
                if(StringUtils.isEmpty(filterstr)){
                    filterstr += "^"+f;
                }else{
                    filterstr += "|^"+f;
                }
            }
        }
//        String filters =  "^1391234|^18500000";
        return memberStoreMapper.selectByCoinAndFilterUser(filterstr);
    }


//    select sum(num),sum(frost_num) from hm_member_store a left join hm_member b on a.member_id = b.id
//    where b.user_status = 1 and a.coins_id = 5
//    and (b.user_account not like '1391234%' and b.user_account not like '18500000%');
//
//
//    select * from hm_member_store a left join hm_member b on a.member_id = b.id
//    where b.user_status = 1 and a.coins_id = 5
//    and (b.user_account not like '1391234%' and b.user_account not like '18500000%');
//
//
//
//    select sum(convert_num),sum(actual_release_num) from `hm_convert_coins_record`
//    where member_account not like '1391234%' and member_account not like '18500000%';
}
